{\rtf1\ansi\ansicpg1252\deff0\deflang1046\deflangfe1046{\fonttbl{\f0\fswiss\fprq2\fcharset0 Arial;}{\f1\fmodern\fprq1\fcharset0 Courier New;}}
{\colortbl ;\red255\green0\blue0;\red0\green128\blue0;\red127\green0\blue85;\red0\green0\blue0;\red63\green127\blue95;\red0\green0\blue192;\red42\green0\blue255;\red128\green0\blue128;}
{\*\generator Msftedit 5.41.21.2509;}\viewkind4\uc1\pard\nowidctlpar\qc\cf1\b\f0\fs20 Sintaxe\par
\par
\pard\nowidctlpar\cf2\b0 Ctrl + I: Identa o c\'f3digo.\par
Ctrl + Shift + F: Identa padr\'f5es Java.\par
O sinal de \b +\b0  \ul concatena.\par
\ulnone Procedure: \cf3\b\f1 public\cf4\b0  \cf3\b void \cf4\b0 nomequalquer();\cf3\b\par
\cf2\lang1033\b0\f0 Function: \cf3\b\f1 public\cf4\b0  \cf3\b int / public boolean / public String....\par
\cf2\b0\f0 //Ambos s\'e3o metodos\ul\par
\cf4\lang1046\ulnone i++ auto-incremento\par
x += i incremento\par
___________________________________________________________________________\cf1\b\par
\pard\nowidctlpar\qc\par
Extends\par
\cf0\b0\par
\pard\nowidctlpar\cf2 Extends serve para juntar informa\'e7\'f5es COMUNS de classes para que n\'e3o haja repeti\'e7\'e3o\par
\par
\cf3\lang1033\b\f1 package\cf4\b0  Extends;\cf0\par
\cf3\b public\cf4\b0  \cf3\b class\cf4\b0  Pessoa \{\cf0\par
\cf4\tab\cf5\lang1046 //\ul dados\ulnone  \ul comuns\ulnone  \ul para\ulnone  \ul pessoa\ulnone  \ul f\'edsica\ulnone  e \ul juridica\cf0\ulnone\par
\cf4\tab\cf3\lang1033\b private\cf4\b0  \cf3\b int\cf4\b0  \cf6 codigo\cf4 ;\cf0\par
\cf4\tab\cf3\b private\cf4\b0  \ul String\ulnone  nome RazaoSocial;\cf0\par
\cf4\tab\cf3\b private\cf4\b0  \cf3\b int\cf4\b0  \cf6 cpf\cf4  \ul CNPJ\ulnone ;\cf0\par
\cf4\tab\cf3\lang1046\b private\cf4\b0  \cf3\b int\cf4\b0  \cf6 idade\cf4 ;\par
\cf3\b\par
\lang1033 package\cf4\b0  Extends;\cf0\par
\cf3\b public\cf4\b0  \cf3\b class\cf4\b0  PessoaFisica \cf3\b extends\cf4\b0  Pessoa \{\cf0\par
\cf4\tab\cf3\b private\cf4\b0  String \cf6 mae\cf4 ;\cf0\par
\cf4\tab\cf3\b private\cf4\b0  String \cf6 pai\cf4 ;\par
\par
\cf3\b package\cf4\b0  Extends;\cf0\par
\cf3\lang1046\b public\cf4\b0  \cf3\b class\cf4\b0  PessoaJuridica \cf3\b extends\cf4\b0  Pessoa\{\cf0\par
\cf4\tab\cf3\b private\cf4\b0  String \cf6 inscMunicipal\cf4 ;\par
\par
\f0 ___________________________________________________________________________\cf1\b\par
\pard\nowidctlpar\qc\par
Documenta\'e7\'e3o\par
\pard\nowidctlpar\cf4\b0 Selecione o c\'f3digo(ou parte dele). \lang1033 Click em Source/Generate Element Comment.\par
\lang1046 S\'f3 funciona em projetos que j\'e1 est\'e3o COPILANDO.\par
\par
\par
\lang1033 ___________________________________________________________________________\cf2\par
\pard\nowidctlpar\qc\cf1\b\par
Escopo do Programa\par
\par
\pard\nowidctlpar\cf3\f1 public\cf4\b0  \cf3\b static\cf4\b0  \cf3\b void\cf4\b0  main(String[] args)\{\par
\cf2\tab\lang1046 //exemplo cria\'e7\'e3o de objeto\cf4\par
\tab Principal p = \cf3\b new\cf4\b0  Principal();\par
\cf2\tab //exemplo chamando procedure com objeto criado\cf4\par
\tab p.menu();\par
\}\par
\f0 __________________________________________________________________________\par
\pard\nowidctlpar\qc\cf1\b\par
Impress\'e3o\par
\par
\pard\nowidctlpar\cf4\b0\f1 System.\cf6\i out\cf4\i0 .println(\cf7 "Digite aqui seu texto"\cf4 );\par
\cf2\f0\par
\cf4 ___________________________________________________________________________\cf1\b\par
\pard\nowidctlpar\qc Declarando OBJETO\par
\pard\nowidctlpar\par
\cf2 nomeclasse nomeobjeto = new nomeclasse( );\par
\par
\cf4 Principal\cf8  \cf4 obj\cf8  \cf4\b0 =\cf8\b  new \cf4 Principal( );\cf1\par
\cf4\b0 ___________________________________________________________________________\cf1\b\par
\pard\nowidctlpar\qc Constante \cf2 (final)\cf1\par
\pard\nowidctlpar\par
\cf3\f1 private\cf4\b0  \cf3\b final\cf4\b0  \cf3\b int\cf4\b0  \cf6 qtdeMax\cf4  = 10;\f0 ___________________________________________________________________________\cf1\b\par
\pard\nowidctlpar\qc\par
Array\par
\pard\nowidctlpar\par
\cf3\f1 private\cf4\b0  Curso \cf6 listaCurso\cf4 [] = \cf3\b new\cf4\b0  Curso[\cf6 qtdeMax\cf4 ];\cf0\par
\cf2\f0\par
\cf4 ___________________________________________________________________________\cf1\b\par
\cf4\b0\par
\pard\nowidctlpar\qc\cf1\b\par
Ler Palavra e N\'famero (method SCANNER)\par
\par
\pard\nowidctlpar\cf3\lang1033\f1 import\cf4\b0  java.util.Scanner;\cf1\b\f0\par
\cf3\f1 public\cf4\b0  String lePalavra(String label)\{\cf0\par
\cf4\tab Scanner sc = \cf3\b new\cf4\b0  Scanner(System.\cf6\i in\cf4\i0 );\cf0\par
\cf4\tab System.\cf6\i out\cf4\i0 .println(label + \cf7 ": "\cf4 );\cf0\par
\cf4\tab\cf3\b return\cf4\b0  sc.next();\cf0\par
\cf4\}\par
\cf3\b\par
public\cf4\b0  \cf3\b int\cf4\b0  leNumero(String label) \{\cf0\par
\cf4\tab Scanner sc = \cf3\b new\cf4\b0  Scanner(System.\cf6\i in\cf4\i0 );\cf0\par
\cf4\tab System.\cf6\i out\cf4\i0 .println(label + \cf7 ": "\cf4 );\cf0\par
\cf4\tab\cf3\b return\cf4\b0  sc.nextInt();\cf0\par
\cf4\lang1046\}\f0\par
___________________________________________________________________________\par
\pard\nowidctlpar\qc\cf1\b\par
Menu (exemplo)\par
\cf3\f1\par
\pard\nowidctlpar public\cf4\b0  \cf3\b int\cf4\b0  menuCurso() \{\cf0\par
\cf4\tab System.\cf6\i out\cf4\i0 .println(\cf7 "[1] Inserir"\cf4 );\cf0\par
\cf4\tab System.\cf6\i out\cf4\i0 .println(\cf7 "[2] Pesquisar"\cf4 );\cf0\par
\cf4\tab System.\cf6\i out\cf4\i0 .println(\cf7 "[3] Alterar"\cf4 );\cf0\par
\cf4\tab System.\cf6\i out\cf4\i0 .println(\cf7 "[4] Excluir"\cf4 );\cf0\par
\cf4\tab System.\cf6\i out\cf4\i0 .println(\cf7 "[9] Sair"\cf4 );\cf0\par
\cf4\tab\cf3\b return\cf4\b0  leNumero(\cf7 "Op\'e7\'e3o"\cf4 );\cf0\par
\cf4\}\par
\f0 ___________________________________________________________________________\par
\par
\pard\nowidctlpar\qc\cf1\b Array Verifica Vazio\par
\par
\pard\nowidctlpar\cf3\f1 public\cf4\b0  \cf3\b int\cf4\b0  listaVazia(\cf3\b int\cf4\b0  qtadeMax, Object lista[]) \{\cf0\par
\cf4\tab\cf3\lang1033\b int\cf4\b0  retorno = \cf6 qtdeMax\cf4 ;\cf0\par
\cf3\b\tab for\cf4\b0  (\cf3\b int\cf4\b0  i = 0; i < lista.\cf6 length\cf4 ; i++) \{\cf0\par
\cf4\tab\tab\cf3\lang1046\b if\cf4\b0  (lista[i] == \cf3\b null\cf4\b0 ) \{\cf0\par
\cf4\tab\tab\tab retorno = i;\cf0\par
\cf4\tab\tab\}\cf0\par
\cf4\tab\}\cf0\par
\cf3\b return\cf4\b0  retorno;\cf0\par
\cf4\}\par
\f0 ___________________________________________________________________________\par
\pard\nowidctlpar\qc\cf1\b\par
Array Verifica Cheio\par
\cf3\f1\par
\pard\nowidctlpar public\cf4\b0  \cf3\b boolean\cf4\b0  verificaCheio() \{\cf0\par
\cf4\tab\cf3\b boolean\cf4\b0  retorno = \cf3\b false\cf4\b0 ;\cf0\par
\cf4\tab\cf3\b int\cf4\b0  pos = listaVazia();\cf0\par
\cf4\tab\cf3\b if\cf4\b0  (pos == \cf6 qtdeMax\cf4 ) \{\cf0\par
\cf4\tab\tab retorno = \cf3\b true\cf4\b0 ;\cf0\par
\cf4\tab\}\cf0\par
\cf4\tab\cf3\b return\cf4\b0  retorno;\cf0\par
\cf4\}\par
\f0 ___________________________________________________________________________\par
\pard\nowidctlpar\qc\cf1\b\par
Excluir\cf4\b0\f1\par
\pard\nowidctlpar\par
\cf3\b public\cf4\b0  \cf3\b void\cf4\b0  excluirMarca() \{\cf0\par
\cf4\tab System.\cf6\i out\cf4\i0 .println(\cf7 "Excluir Marca"\cf4 );\cf0\par
\cf4\tab String nome = lePalavra(\cf7 "Descri\'e7\'e3o"\cf4 );\cf0\par
\cf4\tab\cf3\b int\cf4\b0  pos = buscaMarca(nome);\cf0\par
\cf4\tab\cf3\b if\cf4\b0  (pos != \cf6 qtdeMax\cf4  + 1) \{\cf0\par
\cf4\tab\tab\cf6 listaMarca\cf4 [pos] = \cf3\b null\cf4\b0 ;\cf0\par
\cf4\tab\tab System.\cf6\i out\cf4\i0 .println(\cf7 "Marca Exclu\'edda"\cf4 );\cf0\par
\cf4\tab\} \cf3\b else\cf4\b0  \{\cf0\par
\cf4\tab\tab System.\cf6\i out\cf4\i0 .println(\cf7 "Marca n\'e3o Encontrada"\cf4 );\cf0\par
\cf4\tab\}\cf0\par
\cf4\}\par
\f0 ___________________________________________________________________________\par
\pard\nowidctlpar\qc\cf1\b\par
Alterar\cf4\b0\f1\par
\pard\nowidctlpar\par
\cf3\b public\cf4\b0  \cf3\b void\cf4\b0  alterarMarca() \{\cf0\par
\cf4\tab System.\cf6\i out\cf4\i0 .println(\cf7 "Alterar Marca"\cf4 );\cf0\par
\cf4\tab String nome = lePalavra(\cf7 "Marca"\cf4 );\cf0\par
\cf4\tab\cf3\b int\cf4\b0  pos = buscaMarca(nome);\cf0\par
\cf4\tab\cf3\b if\cf4\b0  (pos != \cf6 qtdeMax\cf4  + 1) \{\cf0\par
\cf4\tab\tab System.\cf6\i out\cf4\i0 .println(\cf7 "Marca Encontrada - "\cf4  + nome);\cf0\par
\cf4\tab\tab\cf6 listaMarca\cf4 [pos].setCodigo(leNumero(\cf7 "C\'f3digo"\cf4 ));\cf0\par
\cf4\tab\tab\cf6 listaMarca\cf4 [pos].setDescricao(lePalavra(\cf7 "Descri\'e7\'e3o"\cf4 ));\cf0\par
\cf4\tab\} \cf3\b else\cf4\b0  \{\cf0\par
\cf4\tab\tab System.\cf6\i out\cf4\i0 .println(\cf7 "Marca n\'e3o Encontrada!"\cf4 );\cf0\par
\cf4\tab\}\cf0\par
\cf4\}\cf2\f0\par
}
 